﻿using MediatR;
using RBAC.LuFang.API.Application.Command.UserCommand;
using RBAC.LuFang.Domain;
using RBAC.LuFang.Domin.Services;
using static System.Collections.Specialized.BitVector32;

namespace RBAC.LuFang.API.Application.CommandHandlers.UserHandler
{
    //用户修改
    public class UserUpdateCommandHandler:IRequestHandler<UserUpdateCommand,int>
    {
        private readonly IUserService _userService;

        public UserUpdateCommandHandler(IUserService userService)
        {
            _userService = userService;
        }

        public async Task<int> Handle(UserUpdateCommand request, CancellationToken cancellationToken)
        {
            var usermodel = new UserInfo() { userInfoID=request.userInfoID, userName=request.userName, password=request.password, userSex=request.userSex, provinceID=request.provinceID, theCityID=request.theCityID, countyID=request.countyID, userAddress=request.userAddress, sectionId= request.sectionId, addName= request.addName, addDate=request.addDate };
            return await _userService.UpdUser(usermodel);
        }
    }
}
